<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Home extends Controller_DefaultTemplate{

public function action_index()
{
	$this->template->content = View::factory('home');
	$category = ORM::factory('category')->order_by('id', 'DESC')->find_all();
	$booklet = ORM::factory('booklet')->order_by('id', 'DESC')->find_all();
	$this->template->content->set('category_list', $category->as_array());
	$this->template->content->set('booklet_list', $booklet->as_array());
}

/**
* Initialize properties before running the controller methods (actions),
* so they are available to our action.
*/
public function before()
{
	// Run anything that need ot run before this.
	parent::before();

	if (!Auth::instance()->logged_in())
	{
		$this->request->redirect('/user/login');
	}
	
}

}
